package com.example.makerspace.controller.individual;

import com.example.makerspace.dto.CompetitionSubmissionDTO;
import com.example.makerspace.dto.DemandDTO;
import com.example.makerspace.dto.Result;
import com.example.makerspace.dto.UserDTO;
import com.example.makerspace.service.ApplicationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

@Controller
@ResponseBody
@RequestMapping("/api/individual")
@Api(tags = "个人中心模块")
public class individualController {
    @Resource
    private ApplicationService applicationService;


    @ApiOperation(value="修改用户头像的状态接口",notes ="修改用户头像的状态接口说明")
    @PostMapping("/updateAvatar")
    public Result updateAvatar(@ModelAttribute UserDTO userDTO){
        return  applicationService.updateAvatar(userDTO);
    }

    @ApiOperation(value="产品点赞接口",notes ="产品点赞接口说明")
    @PostMapping("/addPraise")
    public Result addPraise(@RequestBody DemandDTO demandDTO){
        return  applicationService.addPraise(demandDTO);
    }
    @ApiOperation(value="产品收藏接口",notes ="产品收藏接口说明")
    @PostMapping("/addCollection")
    public Result addCollection(@RequestBody DemandDTO demandDTO){
        return  applicationService.addCollection(demandDTO);
    }

    @ApiOperation(value="前台-分享接口",notes ="前台-分享接口说明")
    @PostMapping("/addShare")
    public Result addShare(@RequestBody DemandDTO demandDTO) {
        return  applicationService.addShare(demandDTO);
    }

    @ApiOperation(value="个人中心展示点赞",notes ="个人中心展示点赞接口")
    @GetMapping("/showPraise")
    public Result showPraise(@RequestParam("username") String username){
        return  applicationService.showPraise(username);
    }

    @ApiOperation(value="个人中心展示收藏",notes ="个人中心展示收藏接口")
    @GetMapping("/showCollection")
    public Result showCollection(@RequestParam("username") String username){
        return  applicationService.showCollection(username);
    }

    //统计未读接口
    @ApiOperation(value="前台-统计点赞未读接口",notes ="前台-统计系统未读消息接口")
    @GetMapping("/showAllPraiseUnRead")
    public Result showAllPraiseUnRead(@RequestParam("username") String username) {
        return  applicationService.showAllPraiseUnRead(username);
    }

    @ApiOperation(value="前台-查看预约信息",notes ="前台-统计系统未读消息接口")
    @GetMapping("/getBooks")
    public Result getBooks(HttpServletRequest request) {
        return  applicationService.getBooks(request);
    }






}
